package com.yfp.goods.service.impl;

import com.yfp.goods.domain.ComboPlan;
import com.yfp.goods.mapper.ComboPlanMapper;
import com.yfp.goods.service.ComboPlanService;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;

import java.util.List;

/**
 * (ComboPlan)表服务实现类
 *
 * 
 * @since 2024-01-03 14:44:59
 */
@Service("comboPlanService")
public class ComboPlanServiceImpl implements ComboPlanService {
    @Resource
    private ComboPlanMapper comboPlanMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param cPlanId 主键
     * @return 实例对象
     */
    @Override
    public ComboPlan queryById(String cPlanId) {
        return this.comboPlanMapper.queryById(cPlanId);
    }

    /**
     * 分页查询
     *
     * @param comboPlan 筛选条件
     * @return 查询结果
     */
    @Override
    public List<ComboPlan> queryByPage(ComboPlan comboPlan) {
        return this.comboPlanMapper.queryAllByLimit(comboPlan);
    }

    /**
     * 新增数据
     *
     * @param comboPlan 实例对象
     * @return 实例对象
     */
    @Override
    public ComboPlan insert(ComboPlan comboPlan) {
        this.comboPlanMapper.insert(comboPlan);
        return comboPlan;
    }

    /**
     * 修改数据
     *
     * @param comboPlan 实例对象
     * @return 实例对象
     */
    @Override
    public ComboPlan update(ComboPlan comboPlan) {
        this.comboPlanMapper.update(comboPlan);
        return this.queryById(comboPlan.getCPlanId());
    }
}
